# -- coding: utf-8 --
from tools.Request_General import BaseAPI


class BusinessModel(BaseAPI):
    """
    业务模型相关接口
    """

    def save_model(self, payload):
        """
        业务模型基础配置保存
        """
        r = self.request_send(json=payload)
        return r

    def get_model(self, payload):
        """
        业务模型基础配置查询
        """
        r = self.request_send(params=payload)
        return r

    def get_relation(self, payload):
        """
        业务模型-配置-基础配置-获取关联元素清单
        """
        r = self.request_send(params=payload)
        return r

    def save_permission(self, payload):
        """
        业务模型-配置-权限配置-保存
        """
        r = self.request_send(json=payload)
        return r

    def authority_role_status(self, payload):
        """
        业务模型-权限配置相关-权限配置查询
        """
        r = self.request_send(params=payload)
        return r


if __name__ == '__main__':
    pass
    # from application.general_create import COOKIE, APP_ID, SPACE_ID
    #
    # headers = {"cookie": COOKIE, "language": "zh-cn", "app": APP_ID, "space": SPACE_ID}
    # r = BusinessModel(version="1.1", headers=headers).save_model(
    #     {'elementName': 'app_TestClickhouse_table', 'folderId': '0', 'pageNum': 1, 'showNum': 20,
    #      'sql': "select parent_name FROM ahbrqy004_testClickhouse_1234 where 1=1;select parent_name FROM ahbrqy004_testClickhouse_1234 where 1=1"})
    # print(r.text)
